﻿using Mes.Domain.BoundedContext;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mes.Application.DTO.Inputs.WorkOrders
{
    /// <summary>
    /// 工单入参
    /// </summary>
    public class WoInput
    {
        /// <summary>
        /// 工单编号
        /// </summary>
        public string Wo_Id { get; set; } = string.Empty;

        /// <summary>
        /// 生产成品
        /// </summary>
        public int Item_Id { get; set; }

        /// <summary>
        /// 投产日期/时间
        /// </summary>
        public DateTime? Release_Time_Local { get; set; } = DateTime.Now;

        /// <summary>
        /// 完工日期/时间
        /// </summary>
        public DateTime? Req_Finish_Time_Local { get; set; } = DateTime.Now;

        /// <summary>
        /// 优先级
        /// </summary>
        public int Wo_Priority { get; set; } = 50;

        /// <summary>
        /// 备注
        /// </summary>
        public string? Notes { get; set; }
    }

    public class AddWoInput : WoInput 
    {
        /// <summary>
        /// 工单名称（描述）
        /// </summary>
        public string? Wo_Desc { get; set; }
    }

    public class UpdateWoInput : WoInput
    {
        /// <summary>
        /// 开工数量
        /// </summary>
        public double Start_Qty { get; set; }

        /// <summary>
        /// 所需数量
        /// </summary>
        public double Req_Qty { get; set; }
    }

    /// <summary>
    /// 分页查询工单入参
    /// </summary>
    public class GetWosInput
    {
        /// <summary>
        /// 查询关键字
        /// </summary>
        public string? KeyWord { get; set; }

        /// <summary>
        /// 分页参数
        /// </summary>
        public PagedInput PagedInput { get; set; } = new PagedInput();
    }

    public class WoInputWithProcess : AddWoInput
    {
        public string ProcessId { get; set; } = string.Empty;

        public int BomId { get; set; } = 0; // BOM表同步AVEVA BOM表后，此输入字段需相应更改 -> VerId : string

        /// <summary>
        /// 开工数量
        /// </summary>
        public double Start_Qty { get; set; }

        /// <summary>
        /// 所需数量
        /// </summary>
        public double Req_Qty { get; set; }
    }

    /// <summary>
    /// 移动作业顺序入参
    /// </summary>
    public class MovingJobSequenceInput
    {
        /// <summary>
        /// 工单编号
        /// </summary>
        public string Wo_Id { get; set; } = string.Empty;

        /// <summary>
        /// 源作业ID
        /// </summary>
        public string FromOper_Id { get; set; } = string.Empty;

        /// <summary>
        /// 目标作业ID
        /// </summary>
        public string ToOper_Id { get; set; } = string.Empty;
    }
}
